<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<%@ page contentType="text/html; charset=UTF-8"%>
<%@ page pageEncoding="UTF-8"%>
<%@taglib prefix="s" uri="/struts-tags"%>
<html>
	<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <script type="text/javascript">
    	$(document).ready(function(){
    		set_input_keydown_event();
    		$('#sex').combobox();
    		$('#specflag').combobox();
    		$('#workerstatus1').combobox();
		    combobox_keypress2('#sex', '#specflag');
		  	combobox_keypress('#specflag','#job');
    		
     		$('#save').click(function (){

                
     		  set_input_keydown_event();
     		  $('#deptno_val').val($('#deptno').val());
     		  $('#sex_val').val($('#sex').combobox('getValue'));
     		  $('#specflag_val').val($('#specflag').combobox('getValue'));
     		  $('#workerstatus_val').val($('#workerstatus1').combobox('getValue'));
     		  $('#identifyno_val').val($('#identifyno').val());
    		  $('#mod_worker_form').form('submit', {
    		    url: 'modWorker.action',error:function(message){
    		    	alert('提交数据错误，服务器可能已关闭！系统返回:'+message);
    		  	},
    		    success:function(data){
    		      var a = eval('(' + data + ')');
    		      $.messager.alert('修改员工', a.message, 'info');
    		      
                  if (a.result=='0'){
                      var $tbl = $('#worker_table');
                      var row = $tbl.datagrid('getSelected');
                      var index = $tbl.datagrid('getRowIndex',row);
                      row.name=$('#name').val();
                      row.workerno=$('#workerno').val();
                      row.sexname=$('#sex').combobox('getText');
                      row.sex=$('#sex').combobox('getValue');
                      row.address=$('#address').val();
                      row.telephone=$('#telephone').val();
                      row.job=$('#job').val();
                      row.specflagname=$('#specflag').combobox('getText');
                      row.specflag=$('#specflag').combobox('getValue');
                      row.workerstatusname=$('#workerstatus1').combobox('getText');
                      row.workerstatus=$('#workerstatus1').combobox('getValue');
                      $tbl.datagrid('refreshRow', index);
                      
                      $('#mod_worker_detail_panel').window('close');
                  }
    		    }
    		    })
    		});

     		$('#cancel').click(function (){
     			$('#mod_worker_detail_panel').window('close');
    		});
  		    $('#mod_worker_detail_panel').window();
    	});
    </script>
	</head>
	<body>
	
    <div id="mod_worker_detail_panel" collapsible="false" fit="false" shadow="false"
    	title="修改员工" resizable="false" collapsible="false" minimizable="false" 
    	maximizable="false" closable="true" closed="true" icon="icon-save" 
    	modal="true" class="jquery_window">
    	<s:form id="mod_worker_form" action="modWorker" cssStyle="margin:20px,50px">
    		<table>
    			<tr height="28px">
    				<td><s:label value="所属机构："></s:label></td>
    				<td><input id="deptno" style="width:200px"
			    		class="text_field_css" disabled="disabled"></input>
			    		<s:hidden name="deptno" id="deptno_val"></s:hidden></td>
    			</tr>
    			<tr height="28px">
    				<td><s:label value="身份证号："></s:label></td>
    				<td><input id="identifyno" style="width:200px"
			    		class="text_field_css" disabled="disabled"></input>
			    		<s:hidden name="identifyno" 
    					id="identifyno_val"></s:hidden></td>
    			</tr>
    			<tr height="28px">
    				<td><s:label value="姓名：" for="name"></s:label></td>
    				<td><input id="name" name="name" 
    					maxlength=<s:property value="%{getText('NAME_LEN')}"/> 
    					style="width:150px" class="text_field_css"></input>
    					<label style="width:4px"></label>
			    		<label style="color:red">*</label><label>必输项</label></td>
    			</tr>
			    <tr height="28px">
    				<td><s:label value="工号：" for="workerno"></s:label></td>
			    	<td style="width:200px"><input id="workerno" name="workerno" 
    					maxlength=<s:property value="%{getText('WORKERNO_LEN')}"/>  
    					style="width:150px" class="text_field_css"></input>
    					<label style="width:4px"></label></td>
			    </tr>
    			<tr height="28px">
    				<td><s:label value="性别：" for="sex"></s:label></td>
			    	<td style="width:200px"><select id="sex" editable="false"
    					style="width:200px" panelHeight="auto">
    					<option value="1">男</option><option value="2">女</option>
    					</select><s:hidden id="sex_val" name="sex"/></td>
    			</tr>
			    <tr height="28px">
    				<td><s:label value="认证方式：" for="specflag"></s:label></td>
			    	<td style="width:200px"><select id="specflag" editable="false"
    					style="width:200px" panelHeight="auto">
    					<option value="0">账户号+指纹</option><option value="1">账户号+密码</option>
    					</select><s:hidden id="specflag_val" name="specflag"/></td>
			    </tr>
    			<tr height="28px">
    				<td><s:label value="员工状态：" for="workerstatus"></s:label></td>
			    	<td style="width:200px"><select id="workerstatus1" editable="false"
    					style="width:200px" panelHeight="auto">
    					<option value="0">正常</option><option value="1">废除</option>
    					</select><s:hidden id="workerstatus_val" name="workerstatus"/></td>
    			</tr>
    			<tr height="28px">
			    	<td><s:label value="岗位：" for="job"></s:label></td>
    				<td style="width:200px"><input id="job" name="job" 
    					maxlength=<s:property value="%{getText('JOB_LEN')}"/>  
			    		style="width:200px" class="text_field_css"></input></td>
    			</tr>
    			<tr height="28px">
			    	<td><s:label value="电话：" for="telephone"></s:label></td>
    				<td style="width:200px"><input id="telephone" name="telephone" 
    					maxlength=<s:property value="%{getText('TELEPHONE_LEN')}"/>  
			    		style="width:200px" class="text_field_css"></input></td>
    			</tr>
    			<tr height="28px">
			    	<td><s:label value="地址：" for="address"></s:label></td>
    				<td style="width:200px"><input id="address" name="address" 
    					maxlength=<s:property value="%{getText('ADDRESS_LEN')}"/>  
			    		style="width:200px" class="text_field_css"></input></td>
    			</tr>
    			<tr height="35px">
    				<td colspan="2" align="center">
            			<button id="save" class="buttons_css" style="width:70px">
            				<label style="70px" class="save_css">保存</label></button>
            			<label style="width:20px"></label>
            			<button id="cancel" class="buttons_css" style="width:70px">
            				<label style="70px" class="cancel_css">返回</label></button>
    				</td>
    			</tr>
    		</table>
    	</s:form>
    </div>
    </body>
</html>